def cal(expression):
    expression.append('#')
    n = len(expression)
    prior = {'#':0, '+':1, '-':1, 'x':2, '*':2, '/':2, '÷':2}
    op = ['#']
    buf = []
    for i in range(n):
        if not isinstance(expression[i], str):
            buf.append(expression[i])
        else:
            while op and prior[expression[i]] <= prior[op[-1]]:
                buf.append(op.pop(-1))
            op.append(expression[i])
    n = len(buf)
    res = []
    for i in range(n-1):
        if not isinstance(buf[i], str):
            res.append(buf[i])
        else:
            if len(res) < 2:
                return False
            b = res.pop(-1)
            a = res.pop(-1)
            if buf[i] is '+':
                res.append(a + b)
            elif buf[i] is '-':
                res.append(a - b)
            elif buf[i] is 'x' or buf[i] is '*':
                res.append(a * b)
            elif buf[i] is '/' or buf[i] is '÷':
                res.append(a / b)
            else:
                res.append(0)
    return res[0]


# 下面是一些测试
# print(cal(['+']))
# print(cal([1, '+', 1]))
# print(cal([3, 'x', 4, '+', 2, '/', 2]))
# print(cal([3, '+', 4, 'x', 2]))
# print(cal([49, '÷', 2, 'x', 44, '÷', 68, '+', 45]))
# print(cal([71, '+', 57, 'x', 48, '-', 94, '-', 22]))